package com.helen.mybatis.session;

import com.helen.mybatis.configration.Configuration;
import com.helen.mybatis.parse.XmlConfigurationBuilder;
import org.dom4j.DocumentException;

import java.beans.PropertyVetoException;
import java.io.InputStream;

/**
 * @author helenlee
 * @date 2020/4/7
 */
public class SqlSessionFactoryBuilder {

    public SqlSessionFactory build(InputStream inputStream) throws DocumentException, PropertyVetoException, ClassNotFoundException {
        Configuration configuration = new Configuration();
        XmlConfigurationBuilder.build(configuration,inputStream);
        return new DefaultSqlSessionFactory(configuration);
    }
}
